package com.last1mile.dao.ibatis.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.stereotype.Component;

import com.last1mile.dao.BaseSqlMapClientDao;
import com.last1mile.dao.interfaces.DistrictDao;
import com.last1mile.pojo.DistrictDO;

@Component("districtDao")
public class DistrictDaoImpl extends BaseSqlMapClientDao implements DistrictDao {
	@SuppressWarnings("unchecked")
	@Override
	public List<DistrictDO> selectByDistrictUpId(String districtUpId)
			throws SQLException {
		DistrictDO key = new DistrictDO();
		key.setDistrictUpId(districtUpId);
		List<DistrictDO> records = (List<DistrictDO>) getSqlMapClientTemplate()
				.queryForList("district.selectByDistrictUpId", key);
		return records;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table district
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public void insert(DistrictDO record) throws SQLException {
		getSqlMapClientTemplate().insert("district.abatorgenerated_insert",
				record);
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table district
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public int updateByPrimaryKey(DistrictDO record) throws SQLException {
		int rows = getSqlMapClientTemplate().update(
				"district.abatorgenerated_updateByPrimaryKey", record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table district
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public int updateByPrimaryKeySelective(DistrictDO record)
			throws SQLException {
		int rows = getSqlMapClientTemplate().update(
				"district.abatorgenerated_updateByPrimaryKeySelective", record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table district
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public DistrictDO selectByPrimaryKey(Integer id) throws SQLException {
		DistrictDO key = new DistrictDO();
		key.setId(id);
		DistrictDO record = (DistrictDO) getSqlMapClientTemplate()
				.queryForObject("district.abatorgenerated_selectByPrimaryKey",
						key);
		return record;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table district
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public int deleteByPrimaryKey(Integer id) throws SQLException {
		DistrictDO key = new DistrictDO();
		key.setId(id);
		int rows = getSqlMapClientTemplate().delete(
				"district.abatorgenerated_deleteByPrimaryKey", key);
		return rows;
	}

}
